#pragma once
#include <iostream>
#include <string>
#include <stdarg.h>
#include <ctime>
#define DEBUG   0
#define NORMAL  1
#define WARNING 2
#define ERROR   3
#define FATAL   4

const char* buffer[] = {
    "DEBUG",
    "NORMAL",
    "WARNING",
    "ERROR",
    "FATAL"
};

void logMassage(int level, const char* format, ...)
{

    va_list args;
    va_start(args, format);

    char stdbuffer[1024] = { 0 };
    time_t tm = time(nullptr);
    snprintf(stdbuffer, sizeof(stdbuffer), "[%s][%ld]", buffer[level], tm);

    char usrbuffer[1024] = { 0 };
    vsnprintf(usrbuffer, sizeof(usrbuffer), format, args);


    printf("%s:%s", stdbuffer, usrbuffer);

    va_end(args);
}